package com.heeexy.example.controller;

import com.alibaba.fastjson.JSONObject;
import com.heeexy.example.service.FilesService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author MyPC
 * @Date 2022/3/31 14:11
 * @description：
 * @Version 1.0
 */

@RestController
@RequestMapping("/files")
public class FilesController {

    private FilesService filesService;

    @Autowired
    public void setFilesService(FilesService filesService) {
        this.filesService = filesService;
    }

    /**
     * 添加数据
     * @param file
     * @param uid
     * @return
     */
    @PostMapping("/uploadFile")
    public JSONObject addfiles(@RequestParam("file")MultipartFile file,@RequestParam("uid") String uid){

        return filesService.addFiles(file,uid);
    }
}
